package springboot.druid.mybatisplus.demo.services.impls;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import springboot.druid.mybatisplus.demo.entities.Stock;
import springboot.druid.mybatisplus.demo.mappers.StockMapper;
import springboot.druid.mybatisplus.demo.services.StockService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author metka499
 * @since 2020-06-24
 */
@Service
public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements StockService {

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public boolean del(Integer id){
        int b = this.baseMapper.deleteById(id);
        //int a = 1/0;
        return b>0;
    }
}
